package org.fdy.bgadmin.controller.business;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.fdy.bgadmin.res.CourseInfoRes;
import org.fdy.bgadmin.res.GraphicData;
import org.fdy.bgadmin.service.HomeService;
import org.fdy.common.core.model.Result;
import org.fdy.common.core.model.auth.SaUser;
import org.fdy.common.core.units.LoginUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>描述：首页</p>
 *
 * @author fangdy
 * @create 2024-07-22 8:03
 */
@Slf4j
@RestController
@RequestMapping("/home")
@RequiredArgsConstructor
@Api(tags = "首页")
public class HomeController {
    private final HomeService homeService;
    @ApiOperation("课程信息")
    @GetMapping(value = "/courseInfo")
    public Result<List<CourseInfoRes>> courseInfo(Integer tableSize) {
        List<CourseInfoRes> list  = homeService.courseInfo(tableSize);
        return Result.ok(list);
    }

    @ApiOperation("图形数据")
    @GetMapping(value = "/graphicData")
    public Result<GraphicData> graphicData() {
        GraphicData res  = homeService.graphicData();
        return Result.ok(res);
    }
}
